#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
@Project : bigDataProject 
@File    : print_api.py
@IDE     : PyCharm 
@Author  : Mario
@Date    : 2022/11/14 10:44 
@Describe: POS支付相关接口
"""
from api.pos_api.base_pos_api import BasePosAPI


class PrintAPI(BasePosAPI):

    def repair_table_order(self, order_no):
        """
        补打台单
        :param order_no:订单号
        :return:
        """
        payload = '{"orderNo":"' + order_no + '"}'
        response = self.http_request('order/printer/repair/table', payload)
        return response

    def order_print_bill(self, order_no):
        """
        打印账单
        :param order_no: 订单号
        :return:
        """
        payload = '{"orderNo":"' + order_no + '"}'
        response = self.http_request('order/printer/bill', payload)
        return response

    def order_print_repair_last(self, order_no):
        """
        补打最末单
        :param order_no:订单号
        :return:
        """
        payload = '{"orderNo":"' + order_no + '"}'
        response = self.http_request('order/printer/repair/last', payload)
        return response

    def order_bank_print(self, order_no, customer_id='9000000022'):
        """
        堂食-正向打印银单
        :param order_no:订单号
        :param customer_id:会员ID
        """
        payload = '{"orderNo":"' + order_no + '","customerId":"' + customer_id + '"}'
        response = self.http_request('order/printer/bank', payload)
        return response

    def kitchen_list(self, order_no):
        """
        获取订单下的厨单列表
        :param order_no:订单号
        :return:
        """
        payload = '{"orderNo":"' + order_no + '"}'
        response = self.http_request('kitchen/list', payload)
        return response

    def kitchen_repair(self, trace_id):
        """
        补打厨单
        :param trace_id: traceId列表
        :return:
        """
        payload = '{"traceIds":["' + trace_id + '"]}'
        response = self.http_request('kitchen/repair', payload)
        return response
